<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel=stylesheet href="css/style.css" type="text/css">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic-el" prefix="logic" %>
<title>Fantacalcio | Ricerca Discussione</title>
</head>
<body>
	<c:if test="${userInSession == null }">
		<c:redirect url="Logout.do"></c:redirect>
	</c:if>
	<c:if test="${listaArgomento == null }">
		<c:redirect url="PrepareCRUDArgomentoAction.do?codOp=aggiungi"></c:redirect>
	</c:if>
		
	<c:import url="/head.jsp"/>
	
	<c:import url="/menu.jsp"/>
	
	<c:import url="menuForum.jsp"/>
	
	<div class="context">
		<h1> Categoria ${categoria.titolo } 
		<c:if test="${userInSession.role.codRole == 'ADMIN' }">
			<a href="ConfermaDeleteCategoriaAction.do?codOp=cancella&id=${categoria.id }">
				<img class= "azioni" alt="cancella" title="cancella" src="images/delete.png">
			</a>
		</c:if></h1>
		<c:if test="${msg != null }">
			<div class="error">
				<span>${msg}</span>
			</div>
		</c:if>
		
		<logic:iterate id="argomento" name="listaArgomento">
			<div class="messaggio">
				<c:if test="${userInSession.role.codRole == 'ADMIN' && argomento.creatore.id == userInSession.id }">
					<span class="cancellaMessaggio"><a href="ConfermaDeleteArgomentoAction.do?codOp=cancella&id=${argomento.id }">
						<img class="azioni" alt="cancella" title="cancella" src="images/delete.png">
					</a></span>
				</c:if>
				
				<span class="messaggioUser"><a href="PrepareCRUDArgomentoAction.do?codOp=apri&id=${argomento.id }">${argomento.titolo }</a></span>
			</div>
			<div class="messaggioTesto">
				<span class="testo">${argomento.descrizione }</span>
			</div>
		</logic:iterate>
		
	</div>
	
	<c:import url="/footer.jsp"/>

</body>
</html>